package com.lagou.util;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;

import java.util.concurrent.TimeUnit;

public class LocalCacheUtil {

    public static Cache getDefaultCache() {
        Cache<String, String> cache = CacheBuilder.newBuilder()
                .maximumSize(20000) // 设置缓存的最大容量
                .expireAfterWrite(1, TimeUnit.MINUTES) // 设置缓存在写入一分钟后失效
                .concurrencyLevel(20) // 设置并发级别为10
                .build();
        return cache;
    }


}

